import { BasicColumn } from '/@/components/Table';
import { FormSchema } from '/@/components/Table';
import { rules } from '/@/utils/helper/validator';
import { render } from '/@/utils/common/renderUtils';
import { UploadTypeEnum } from '/@/components/Form/src/jeecg/components/JUpload';
//列表数据
export const columns : BasicColumn[] = [
	{
		title: '审核',
		align: "center",
		dataIndex: 'stats',
		customRender: ({ text }) => {
			if (text == 'Apply') return '审核通过'
			if (text == 'Pass') return '审核未通过'
			if (text == 'WaitAudit') return '待审核'
		}
	},
	{
		title: '发布时间',
		align: "center",
		dataIndex: 'createTime'
	},
	{
		title: '用户',
		align: "center",
		dataIndex: 'userId_dictText'
	},
	{
		title: '回复哪条消息',
		align: "center",
		dataIndex: 'replyId_dictText'
	},
	{
		title: '图片',
		align: "center",
		dataIndex: 'img',
		customRender: ({ text }) => {
			let imgs = JSON.parse(text)

			return render.renderImage({ text: imgs.join(',') })
		}
	},
	{
		title: '文字',
		align: "center",
		dataIndex: 'content'
	},
	{
		title: '点赞数',
		align: "center",
		sorter: true,
		dataIndex: 'zanNum'
	},
	{
		title: '回复数',
		align: "center",
		sorter: true,
		dataIndex: 'repleNum'
	},
	{
		title: '是否置顶',
		align: "center",
		sorter: true,
		dataIndex: 'isTop_dictText'
	},
	{
		title: '是否推荐到游记',
		align: "center",
		sorter: true,
		dataIndex: 'isStrategy_dictText'
	},
	{
		title: '评论类别',
		align: "center",
		dataIndex: 'commentType_dictText'
	},
	{
		title: '租户',
		align: "center",
		dataIndex: 'tenantId_dictText'
	},
];
//查询数据
export const searchFormSchema : FormSchema[] = [
	{
		label: "是否置顶",
		field: 'isTop',
		component: 'JDictSelectTag',
		componentProps: {
			dictCode: "couple_is"
		},
		//colProps: {span: 6},
	},
	{
		label: "是否推荐到游记",
		field: 'isStrategy',
		component: 'JDictSelectTag',
		componentProps: {
			dictCode: "couple_is"
		},
		//colProps: {span: 6},
	},
	{
		label: '审核',
		field: 'stats',
		component: 'JDictSelectTag',
		componentProps: {
			options: [
				{ label: '待审核', value: 'WaitAudit' },
				{ label: '审核未通过', value: 'Pass' },
				{ label: '审核通过', value: 'Apply' }
			]
		}
	},
	{
		label: "评论类别",
		field: 'commentType',
		component: 'JDictSelectTag',
		componentProps: {
			dictCode: "sys_category,name,code,pid='1724667049273282561'"
		},
		//colProps: {span: 6},
	},
];
//表单数据
export const formSchema : FormSchema[] = [

	{
		label: '图片',
		field: 'imgs',
		component: 'JUpload',
		helpMessage: '最多上传9张图片',
		componentProps: {
			fileType: UploadTypeEnum.image,
			maxCount: 9,
		},
	},
	{
		label: '审核',
		field: 'stats',
		component: 'JDictSelectTag',
		componentProps: {
			options: [
				{ label: '待审核', value: 'WaitAudit' },
				{ label: '审核未通过', value: 'Pass' },
				{ label: '审核通过', value: 'Apply' }
			]
		}
	},
	{
		label: '文字',
		field: 'content',
		component: 'InputTextArea',
	},
	{
		label: '是否置顶',
		field: 'isTop',
		component: 'JDictSelectTag',
		componentProps: {
			dictCode: "couple_is"
		},
	},
	{
		label: '是否推荐到游记',
		field: 'isStrategy',
		component: 'JDictSelectTag',
		componentProps: {
			dictCode: "couple_is"
		},
	},
	// TODO 主键隐藏字段，目前写死为ID
	{
		label: '',
		field: 'id',
		component: 'Input',
		show: false
	},
];



/**
* 流程表单调用这个方法获取formSchema
* @param param
*/
export function getBpmFormSchema(_formData) : FormSchema[] {
	// 默认和原始表单保持一致 如果流程中配置了权限数据，这里需要单独处理formSchema
	return formSchema;
}